//
//  UserDefaultManager.m
//  DriveStudy
//
//  Created by chen on 2017/4/26.
//  Copyright © 2017年 chen. All rights reserved.
//

#import "UserDefaultManager.h"

#define WRONG_QUESTION @"WRONG_QUESTION"
#define COLLECT_QUESTION @"COLLECT_QUESTION"

@implementation UserDefaultManager

+(NSArray *)getWrongQuestion{
    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:WRONG_QUESTION];
    if (array !=nil) {
        return array;
    }else{
        return @[];
    }
}
+(void)addWrongQuestion:(NSString *)mid{
    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:WRONG_QUESTION];
    NSMutableArray *muArr = [NSMutableArray arrayWithArray:array];
    [muArr addObject:mid];
    [[NSUserDefaults standardUserDefaults]setObject:muArr forKey:WRONG_QUESTION];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(void)removeWrongQuestion:(NSString *)mid{
    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:WRONG_QUESTION];
    NSMutableArray *muArr = [NSMutableArray arrayWithArray:array];
    [muArr removeObject:mid];
    [[NSUserDefaults standardUserDefaults]setObject:muArr forKey:WRONG_QUESTION];
    [[NSUserDefaults standardUserDefaults] synchronize];
}


+(NSArray *)getCollectQuestion{
    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:COLLECT_QUESTION];
    if (array !=nil) {
        return array;
    }else{
        return @[];
    }
}
+(void)addCollectQuestion:(NSString *)mid{
    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:COLLECT_QUESTION];
    NSMutableArray *muArr = [NSMutableArray arrayWithArray:array];
    [muArr addObject:mid];
    [[NSUserDefaults standardUserDefaults]setObject:muArr forKey:COLLECT_QUESTION];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+(void)removeCollectQuestion:(NSString *)mid{
    NSArray *array = [[NSUserDefaults standardUserDefaults]objectForKey:COLLECT_QUESTION];
    NSMutableArray *muArr = [NSMutableArray arrayWithArray:array];
    [muArr removeObject:mid];
    [[NSUserDefaults standardUserDefaults]setObject:muArr forKey:COLLECT_QUESTION];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
@end
